package com.cn.keysynchronized;

/**
 * Created by chenyuncong on 2019/8/15.
 */
public class SynchronizedThread implements Runnable {
    public SynchronizedThread(Integer id) {
        this.id = id;
    }

    private Integer id;
    @Override
    public void run() {
        try {
//            if(!SynchronizedMap.map.containsKey(id)){
//                SynchronizedMap.map.put(id,id);
//            }
            synchronized (id){
                System.out.println(id);
                Thread.sleep(2000);
            }

        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public void lock(Integer id){

    }
}
